<?php

/**
 * Description of G_JsonConfigs
 * @author 耿鸿飞<eoe2005@qq.com>
 */
class G_JsonConfig extends GC_Config{
    protected $_json;
    public function __construct($filepath) {
        $this->_json = json_decode(@file_get_contents($filepath),true);
        if($this->_json){
            
        }else{
            trigger_error("读取配置文件失败");
            die();
        }
    }
    public function getItem($key) {
        $keys = explode(".", $key);
        $data = $this->_json;
        $rs = null;
        foreach($keys AS $val){
            if(isset($data[$val])){
                $rs = $data[$val];
            }else{
                return null;
            }
        }
        return $rs;
    }    
}

?>
